package com.apps.MiniChat;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class MenuOption extends Activity implements OnClickListener{

	private Button saveButton = null;
	private EditText serverPort;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        setContentView(R.layout.menu_option);
        serverPort = (EditText) findViewById(R.id.serverPort);
	    serverPort.setText(Integer.toString(MenuChat.Port));
	    saveButton = (Button) findViewById(R.id.buttonSave);
	    saveButton.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if (v.getId() == R.id.buttonSave)
		{
			Log.d("Option", "Touch");
			Intent myIntent = getIntent();
			myIntent.putExtra("ServerPort",Integer.parseInt(serverPort.getText().toString()));
			setResult(RESULT_OK, myIntent);
			finish();
		}
        
	}

}
